/**
 * Copyright (c) 2018 软唐 All rights reserved.
 *
 * https://www.softtown.cn
 *
 * 版权所有，侵权必究！
 */

package com.softtown.modules.dapai.controller;

import com.github.pagehelper.PageInfo;
import com.softtown.common.utils.Result;
import com.softtown.modules.dapai.dto.*;
import com.softtown.modules.dapai.entity.CompCustomerAppEntity;
import com.softtown.modules.dapai.entity.CompCustomerEntity;
import com.softtown.modules.dapai.entity.CompCustomerReportEntity;
import com.softtown.modules.dapai.service.CompCustomerAppService;
import com.softtown.modules.dapai.service.CompCustomerReportService;
import com.softtown.modules.dapai.service.CompCustomerService;
import com.softtown.modules.dapai.vo.CompCustomerReportVO;
import com.softtown.modules.dapai.vo.CompCustomerVO;
import com.softtown.modules.dapai.vo.CustomerContactsVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * 报备
 *
 * @author Ding Ya Yong
 */
@RestController
@RequestMapping("report")
@Api(tags="报备")
public class CompCustomerReportController {

    @Resource
    private CompCustomerReportService compCustomerReportService;


    @PostMapping("getCustomerReportPageList")
    @ApiOperation("获取报备分页")
    public Result getCustomerReportPageList(@RequestBody CustomerReportDTO customerReportDTO) {
        PageInfo<CompCustomerReportEntity> compCustomerReportEntityPageInfo = compCustomerReportService.getCustomerReportPageList(customerReportDTO);
        return new Result<PageInfo<CompCustomerReportEntity>>().ok(compCustomerReportEntityPageInfo);
    }



    @PostMapping("getCustomerReportById")
    @ApiOperation("获取报备详情")
    public Result<CompCustomerReportVO> getCustomerReportById(@RequestBody CustomerReportDTO customerReportDTO) {
        CompCustomerReportVO compCustomerReportVO = compCustomerReportService.getCustomerReportById(customerReportDTO.getCompId(),customerReportDTO.getId());
        return new Result<CompCustomerReportVO>().ok(compCustomerReportVO);
    }


    @PostMapping("addCustomerReport")
    @ApiOperation("添加报备")
    public Result addCustomerReport(@RequestBody CompReportAddOrUpdateDTO compReportAddOrUpdateDTO) {
        Result result = new Result<>();
        compCustomerReportService.addCustomerReport(compReportAddOrUpdateDTO);
        return result;
    }


}